<?php
include_once 'common.inc.php';

if($operation == 'display'){
	$total = pdo_fetchcolumn("select count(1) from ".tablename(MODULE_PREFIX.'member')." where uniacid =:uniacid and parentid =:parentid ",array(':uniacid'=>$uniacid,':parentid'=>$members['id']));
	$list  =  pdo_fetchall("select * from ".tablename(MODULE_PREFIX.'member')." where uniacid =:uniacid and parentid =:parentid ",array(':uniacid'=>$uniacid,':parentid'=>$members['id']));
	
	foreach ($list as $key => &$value) {
		$value['member'] = pdo_fetch("select nickname,avatar from ".tablename('mc_members')." where uniacid =:uniacid and uid =:uid ",array(':uniacid'=>$uniacid,':uid'=>$value['uid']));
		$value['avatar'] = $value['member']['avatar'];
		$value['nickname'] = $value['nickname']?$value['nickname']:$value['member']['nickname'];
		$value['count'] = pdo_fetchcolumn("select count(1) from ".tablename(MODULE_PREFIX.'member')." where uniacid =:uniacid and parentid =:parentid ",array(':uniacid'=>$uniacid,':parentid'=>$value['id']));
	}
}

include $this->template('down');